from concurrent import futures
import requests
import asyncio


from concurrents import BASE_URL, save_flag, show, POP20_CC


async def get_flag(cc: str, loop:asyncio.AbstractEventLoop):
    url = '{}/{cc}/{cc}'.format(BASE_URL, cc=cc.lower())
    future = loop.run_in_executor(None, requests.get, url)
    return future


async def download_one(cc):
    image = await get_flag(cc)
    show(cc)
    save_flag(image, cc.lower() + '.gif')
    return cc

async def download_many(cc_list):
    pass
